QTT fundamentals coupling: my-qtt verified-core checker + Idris substitution-algebra slices#116
Merged
Merged
Conversation
hyperpolymath
marked this pull request as ready for review
June 17, 2026 23:08
hyperpolymath
enabled auto-merge (rebase)
June 17, 2026 23:10
…ward #108) First slice of the htSubst -> preservation port (Coq SoloCore.v is the blueprint). Lands the scalar/accounting foundation, all green under %default total, hole-free: - shiftn iterated weakening shift - htShift0 one-binder weakening (htShift at I=TEmpty) - qAddRearrange middle-four exchange for qAdd - qReassoc the Q-semiring identity behind additive-split subst, via the named semiring laws (no 3^6 enumeration) - uaddUscaleZeroR Zero-scaled summand is the additive identity Refs #108
… toward #108) The affine-accounting heart of ht_subst, all green under %default total: - combMaybe / uaddUSnocReduce / uaddSnocSplit USnoc-tail uadd helpers - vecReassoc lifts qReassoc to usage vectors (Maybe-equation form) - substReassocAdd additive-split residual combine (uaddTotal + vecReassoc) - substReassocMult multiplicative-split variant (q'=One) Mirrors Coq vec_reassoc / subst_reassoc_add / subst_reassoc_mult. Refs #108
…, toward #108) Completes the substitution accounting algebra, all green under %default total: - usplit3 USnoc-boundary usage split by length (drops unused ulen-dg conjunct vs Coq usplit3) - uaddSplitBoundary2 USnoc-headed boundary sum split (heads add: q=q1+q2) - substVarSucc deeper-index subst commutes with one weakening shift (GT case needs minusZeroRight to bridge the stuck minus) Mirrors Coq usplit3 / uadd_split_boundary2 / subst_var_succ. With A1+A2+A3 the full accounting layer beneath hvSubst/htSubst is done. Refs #108
…#108) The variable case of the QTT substitution lemma (mirrors Coq hv_subst), green under %default total. Prefix-I induction; matches n=Z/S n0 at runtime and bridges varInv's erased witness via predEq'. Two leaves: - substituted variable itself -> returns u, usage scaled by q (uaddZeroL) - any other variable -> unchanged, Zero-scaled (uaddUscaleZeroR), re-weakened by htShift0 + substVarSucc Refs #108
…5/R5b
First strand of the fundamentals -> implementation coupling (the path the user
chose). proofs/STATUS.md flags that the mechanised QTT core and the Rust
compiler are 'two disconnected universes': checker.rs is a conventional Hindley
checker with no usage/multiplicity axis. This new crate ports the
machine-checked usage-walk synthesiser into the compiler's own language:
- Q semiring {0,1,ω} (qadd/qmul/qle) — Coq Quantity.v tables verbatim
- usage vectors (uzero/onehot/uadd/uscale/ule) — Coq SoloCore.v
- check : Tctx -> Tm -> Option<(Ty,Uvec)> — the one-pass synthesiser
(SoloCore.v:2128), returning the type AND exact realised usage
- aff_check — the affine-budget decision (aff_type_dec / aff_type_iff, R5b)
Faithful de Bruijn (snoc-list <-> Vec, innermost = last). 7 tests green,
incl. the 4 SoloCore.v 'reflexivity' Examples reproduced as oracle tests
(check_id_unit / drop_linear / dup_linear / dup_omega) + the R5b affine
discard — so the port is checked against the verified algorithm's own
closed computations. No external deps; cargo test -p my-qtt passes.
Next coupling step: elaborate the my-lang surface AST onto this core so the
running checker enforces the resource axis. Refs proofs/STATUS.md.
hyperpolymath
force-pushed
the
claude/dreamy-hypatia-O8XHo
branch
from
June 17, 2026 23:13
c0c6418 to
da9363c
Compare
hyperpolymath
disabled auto-merge
June 18, 2026 00:11
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two strands, both green, advancing the fundamentals → implementation axis.
1.
crates/my-qtt— QTT verified-core checker (the coupling, NEW)proofs/STATUS.md§"Implementation ⇄ spec coupling" records that the mechanised QTT core and the Rust compiler are two disconnected universes —checker.rs(1830 LOC) is a conventional Hindley checker with no usage/multiplicity axis. This crate is the first concrete bridge: a faithful Rust port of the machine-checked Coq usage-walk synthesiser (SoloCore.vrung R5check/ R5baff_type_dec).Qsemiring{0,1,ω}(qadd/qmul/qle) — CoqQuantity.vtables verbatimuzero/onehot/uadd/uscale/ule)check : Tctx -> Tm -> Option<(Ty, Uvec)>— the one-pass synthesiser (SoloCore.v:2128), returning the type and the exact realised usageaff_check— the affine-budget decision (aff_type_dec/aff_type_iff, R5b)Vec, innermost = last)SoloCore.vreflexivityExamples reproduced as oracle tests (check_id_unit/drop_linear/dup_linear/dup_omega) + the R5b affine discard — so the port is checked against the verified algorithm's own closed computations. No external deps.2. Idris substitution-algebra slices (toward #108
preservation)The accounting layer beneath
htSubst, all--build-checked, hole-free,%default total(these were built after #115 and are not yet onmain):shiftn,htShift0,qReassoc(via the named semiring laws, no 3⁶ enumeration),uaddUscaleZeroRvecReassoc,substReassocAdd,substReassocMult(the affine-accounting reassociation)usplit3,uaddSplitBoundary2,substVarSucchvSubst(the variable case of the QTT substitution lemma)htSubst(the 15-case main lemma) +subst2Lemma+preservationremain the open tail of #108; a working draft is parked locally.Test plan
cargo test -p my-qtt→ 7 passed (no LLVM toolchain needed)idris2 --build solo-core.ipkgexits 0, only?todo_preservationholeNext coupling step
Elaborate the my-lang surface AST onto the
my-qttcore so the running checker enforces the resource axis (today it doesn't). Then targets per the roadmap (LLVM wasm32 → RISC-V → mobile; typed-wasm WasmGC as the verified leg).Refs #108,
proofs/STATUS.md🤖 Generated with Claude Code
Generated by Claude Code